package pt.isec.a21210392.a21190220.ludotwist.GameLogic;

import pt.isec.a21210392.a21190220.ludotwist.R;

public class ThrowDiceHouse extends House
{
	private static final long serialVersionUID = 1L;
	
	public ThrowDiceHouse(int number, int line, int column)
	{
		super(number, R.drawable.dice, line, column);
	}
	
	@Override
	public int getDestiny(Pin pin, int diceResult)
	{
		return this.getNumber();
	}
	@Override
	public void arrivedHere(Pin pin, int diceResult)
	{
		this.setVisitor(pin);
		pin.RollAgain();
	}
	@Override
	public int getImage() 
	{
		if (visitor == null)
		{
			return super.getImage();
		}
		if (visitor.getColor().equals("RED"))
		{
			return (visitor instanceof SuperPin) ? R.drawable.dice_red_super_pin : R.drawable.dice_red_pin;
		}
		if (visitor.getColor().equals("GREEN"))
		{
			return (visitor instanceof SuperPin) ? R.drawable.dice_green_super_pin : R.drawable.dice_green_pin;
		}
		if (visitor.getColor().equals("BLUE"))
		{
			return (visitor instanceof SuperPin) ? R.drawable.dice_blue_super_pin : R.drawable.dice_blue_pin;
		}
		return (visitor instanceof SuperPin) ? R.drawable.dice_yellow_super_pin : R.drawable.dice_yellow_pin;
	}
}
